package com.klikmee.sms.chat.web.usecases;

import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;

import org.json.JSONException;

import com.dotexe.webframework.core.ClientApplication;
import com.dotexe.webframework.core.datasources.ObjectDataSource;

public class AnswerPreviewForm extends ClientApplication {

	private ObjectDataSource dsPreview;
	private ArrayList<String> bcPreview;

	// override
	public void load() throws Exception {
		super.load();

		this.dsPreview = new ObjectDataSource("dsPreview");
		this.getDataSources().add(this.dsPreview);

		this.bcPreview = new ArrayList<String>();
		this.bcPreview.add("Question");
		this.bcPreview.add("Answer");
	}

	@Override
	public void start() throws Exception {
		super.start();
	}

	public void setPreviewSource(com.klikmee.sms.chat.web.dto.Question selectedItem) throws ClassNotFoundException, NoSuchFieldException, IllegalAccessException, JSONException, NoSuchMethodException, InvocationTargetException {
		this.dsPreview.setSource(selectedItem);
		this.dsPreview.bind(this.bcPreview);
	}
}